/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entity;

import java.io.Serializable;
import java.sql.Date;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

/**
 *   
 * @author cheeseng
 */
@Entity
public class SalesInquiry implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long inquiryId;
    @ManyToOne(cascade = {CascadeType.PERSIST})
    private SalesLead saleLead;
    private String inquiryNum;
    @OneToMany(cascade = {CascadeType.PERSIST})
    private List<SalesItem> saleItems = new ArrayList();
    private String contactPerson;
    private String salutation;
    @OneToOne(cascade = {CascadeType.PERSIST})
    private Address companyAddress;
    private String email;
    private String phone;
    private Date createdDate;
    @OneToOne(cascade = {CascadeType.PERSIST}, mappedBy="saleInquiry")
    private SystemUser createdBy;
    private Integer gst;
    private String additionalChargeDesc;
    private Double additionalCharge;
    private String additionalChargeType;
    private String transportChargeType;
    private Double transportCharge;
    private String saleTerm;

    public SalesInquiry() {
    }

    public void create(String inquiryNum, String contactPerson, String salutation, String email, String phone, Date createdDate, Integer gst, String additionalChargeDesc, String additionalChargeType, Double additionalCharge, String transportChargeType, Double transportCharge, String saleTerm) {
        this.inquiryNum = inquiryNum;
        this.contactPerson = contactPerson;
        this.salutation = salutation;
        this.email = email;
        this.phone = phone;
        this.gst = gst;
        this.additionalChargeDesc = additionalChargeDesc;
        this.additionalCharge = additionalCharge;
        this.additionalChargeType = additionalChargeType;
        this.transportChargeType = transportChargeType;
        this.transportCharge = transportCharge;

        this.saleTerm = saleTerm;
        this.createdDate = createdDate;
    }

    public String getInquiryNum() {
        return inquiryNum;
    }

    public void setInquiryNum(String inquiryNum) {
        this.inquiryNum = inquiryNum;
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    public Double getAdditionalCharge() {
        return additionalCharge;
    }

    public void setAdditionalCharge(Double additionalCharge) {
        this.additionalCharge = additionalCharge;
    }

    public String getAdditionalChargeDesc() {
        return additionalChargeDesc;
    }

    public void setAdditionalChargeDesc(String additionalChargeDesc) {
        this.additionalChargeDesc = additionalChargeDesc;
    }

    public String getAdditionalChargeType() {
        return additionalChargeType;
    }

    public void setAdditionalChargeType(String additionalChargeType) {
        this.additionalChargeType = additionalChargeType;
    }

    public Integer getGst() {
        return gst;
    }

    public void setGst(Integer gst) {
        this.gst = gst;
    }

    public String getSaleTerm() {
        return saleTerm;
    }

    public void setSaleTerm(String saleTerm) {
        this.saleTerm = saleTerm;
    }

    public Double getTransportCharge() {
        return transportCharge;
    }

    public void setTransportCharge(Double transportCharge) {
        this.transportCharge = transportCharge;
    }

    public String getTransportChargeType() {
        return transportChargeType;
    }

    public void setTransportChargeType(String transportChargeType) {
        this.transportChargeType = transportChargeType;
    }

    public Address getCompanyAddress() {
        return companyAddress;
    }

    public void setCompanyAddress(Address companyAddress) {
        this.companyAddress = companyAddress;
    }

    public String getContactPerson() {
        return contactPerson;
    }

    public SystemUser getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(SystemUser createdBy) {
        this.createdBy = createdBy;
    }

    public void setContactPerson(String contactPerson) {
        this.contactPerson = contactPerson;
    }

    public List<SalesItem> getSaleItems() {
        return saleItems;
    }

    public void setSaleItems(List<SalesItem> saleItems) {
        this.saleItems = saleItems;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Long getInquiryId() {
        return inquiryId;
    }

    public void setInquiryId(Long inquiryId) {
        this.inquiryId = inquiryId;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public SalesLead getSaleLead() {
        return saleLead;
    }

    public void setSaleLead(SalesLead saleLead) {
        this.saleLead = saleLead;
    }

    public String getSalutation() {
        return salutation;
    }

    public void setSalutation(String salutation) {
        this.salutation = salutation;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (inquiryId != null ? inquiryId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SalesInquiry)) {
            return false;
        }
        SalesInquiry other = (SalesInquiry) object;
        if ((this.inquiryId == null && other.inquiryId != null) || (this.inquiryId != null && !this.inquiryId.equals(other.inquiryId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.SaleInquiry[ id=" + inquiryId + " ]";
    }
}
